'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Point = function () {
  // 构造方法
  function Point(x, y) {
    _classCallCheck(this, Point);

    this.x = x;
    this.y = y;
  }

  _createClass(Point, [{
    key: 'toString',
    value: function toString() {
      return '(' + this.x + ',' + this.y + ')';
    }
  }]);

  return Point;
}();

var point = new Point('haha', 12);
console.log(point.toString());
console.log(typeof Point === 'undefined' ? 'undefined' : _typeof(Point)); //function
console.log(Point === Point.prototype.constructor); // true
// 类创建出来的对象，公用一个原型对象
var point1 = new Point(2, 3);
var point2 = new Point(3, 3);
console.log(point1.__proto__ === point2.__proto__); // true

console.log(Object.getPrototypeOf(point1) === Point.prototype); //获取指定对象的原型